﻿<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title th:text="@{'Update Service - ' + ${service.name}}"></title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #18bc9c;
            --danger-color: #e74c3c;
        }

        body {
            background-color: #f8f9fa;
            min-height: 100vh;
            display: flex;
            align-items: center;
            padding: 2rem;
        }

        .service-card {
            max-width: 600px;
            margin: 0 auto;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            padding: 2rem;
        }

        h1 {
            color: var(--primary-color);
            border-bottom: 3px solid var(--secondary-color);
            padding-bottom: 0.75rem;
            margin-bottom: 2rem;
            font-size: 1.8rem;
        }

        .form-label {
            font-weight: 500;
            color: var(--primary-color);
        }

        .form-control {
            border: 2px solid #dee2e6;
            border-radius: 8px;
            padding: 0.75rem 1rem;
            transition: all 0.3s ease;
        }

        .form-control:focus {
            border-color: var(--secondary-color);
            box-shadow: 0 0 0 3px rgba(24, 188, 156, 0.25);
        }

        .btn-submit {
            background-color: var(--secondary-color);
            color: white;
            padding: 0.75rem 2rem;
            border-radius: 8px;
            border: none;
            font-weight: 600;
            transition: transform 0.2s, opacity 0.3s;
        }

        .btn-submit:hover {
            opacity: 0.9;
            transform: translateY(-1px);
        }

        .nav-links {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid #eee;
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
        }

        .nav-link {
            color: var(--primary-color);
            text-decoration: none;
            padding: 0.5rem 1rem;
            border-radius: 6px;
            transition: all 0.3s ease;
        }

        .nav-link:hover {
            background-color: rgba(24, 188, 156, 0.1);
            color: var(--secondary-color);
        }

        @media (max-width: 576px) {
            body {
                padding: 1rem;
            }

            .service-card {
                padding: 1.5rem;
            }

            .nav-links {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
<div class="service-card">
    <h1 th:text="@{'Update Service: ' + ${service.name}}"></h1>

    <form id="update_form" action="/info/update" method="post">
        <div class="mb-4">
            <label for="name" class="form-label">Service Name</label>
            <input type="text"
                   class="form-control"
                   id="name"
                   name="name"
                   th:value="${service.name}"
                   required>
        </div>

        <div class="mb-4">
            <label for="domain" class="form-label">Domain</label>
            <input type="text"
                   class="form-control"
                   id="domain"
                   name="domain"
                   th:value="${service.domain}"
                   required>
        </div>

        <div class="mb-4">
            <label for="port" class="form-label">Port</label>
            <input type="number"
                   class="form-control"
                   id="port"
                   name="port"
                   th:value="${service.port}"
                   min="1"
                   max="65535"
                   >
        </div>

        <button type="submit" class="btn-submit w-100">
            🚀 Update Configuration
        </button>
    </form>

    <div class="nav-links">
        <a href="/" class="nav-link">🏠 Back to Chat</a>
        <a href="/info" class="nav-link">📋 Service List</a>
        <a href="/info/update" class="nav-link">🔄 Refresh</a>
        <a href="/?logout=true" class="nav-link text-danger">🚪 Logout</a>
    </div>
</div>
</body>
</html>